using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq;
using Seer.SeerSocket;

namespace 常驻后台的数据导出服务.Controllers;

[ApiController]
[Route("[controller]")]
public class UserController : ControllerBase
{

    private readonly ILogger<UserController> logger;
    private readonly SqliteDbContext dbContext;

    public UserController(ILogger<UserController> logger, SqliteDbContext dbContext,SeerSocket seer)
    {
        this.logger = logger;
        this.dbContext = dbContext;
    }

    [HttpGet]
    public async Task<IEnumerable<User>> Get()
    {
        return await dbContext.Users.ToListAsync();
    }

    [HttpPost]
    public async Task Save(UserRequest user)
    {
        dbContext.Users.Add(new User { NickName = user.NickName });
        await dbContext.SaveChangesAsync();
    }
}


